# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=range-v3
pkgver=0.11.0
pkgrel=0
pkgdesc="Experimental range library for C++11/14/17"
options="!check"
url="https://github.com/ericniebler/range-v3"
arch="noarch"
license="BSL-1.0"
makedepends="cmake ninja"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/ericniebler/range-v3/archive/$pkgver.tar.gz"

prepare() {
	sed -e '/Werror/d' -i cmake/ranges_flags.cmake
	default_prepare
}

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DRANGE_V3_EXAMPLES=OFF \
		-DRANGE_V3_PERF=OFF \
		-DRANGE_V3_TESTS=OFF \
		-DRANGE_V3_HEADER_CHECKS=ON \
		-DRANGES_MODULES=OFF \
		-DRANGES_NATIVE=OFF \
		-DRANGES_DEBUG_INFO=OFF \
		-DRANGES_PREFER_REAL_CONCEPTS=ON \
		-DRANGES_VERBOSE_BUILD=ON \
		$CMAKE_CROSSOPTS
	ninja -C build
}

package() {
	DESTDIR="$pkgdir" ninja -C build install
}

sha512sums="9d6cdcbc1e50104206ba731c3bdc9aab3acfcf69cd83f0e0b4de18b88df2a9e73d64e55638421768d4433c542b6619f6e5af6b17cccd3090cf8b4d4efe9863e4  range-v3-0.11.0.tar.gz"
